﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/EShop.master" AutoEventWireup="true" CodeFile="NewAds.aspx.cs" Inherits="EShop_NewAds" %>
<%@ Register assembly="CKEditor.NET" namespace="CKEditor.NET" tagprefix="CKEditor" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">    
    <%--<link href="<%= ResolveUrl("~/Styles/uploadify.css")%>" rel="stylesheet" type="text/css" />--%>
    <script src="<%= ResolveUrl("~/Scripts/jquery.uploadify.v2.1.4.js")%>" type="text/javascript"></script>
    <script src="<%= ResolveUrl("~/Scripts/swfobject.js")%>" type="text/javascript"></script>
    <style>
        .thumbs{width:30px; height:30px;}
    </style>
    <script type="text/javascript">
        function changeName(ele) {
            if (ele.value != "") {
                document.getElementById("<%=txtfileUpload.ClientID %>").value = ele.value;
            }
        }
    </script>
    <%--<link href="<%= ResolveUrl("~/Styles/uploader.css")%>" rel="stylesheet" type="text/css" />--%>
    <div class="middleProduct_holder">
        <h1>Upload hình</h1>
        <div style="margin-left:20px">
            <div class="rows">
                <span class="leftrow">Tiêu đề tin:</span>
                <span class="rightrow">
                    <asp:TextBox ID="txtTitleAdv" runat="server"></asp:TextBox>
                </span>
            </div>
            <br class="clear" />
            <div class="rows">
                <span class="leftrow">Giá tiền:</span>
                <span class="rightrow">
                    <asp:TextBox ID="txtprice" runat="server"></asp:TextBox>
                </span>
            </div>
            <br class="clear" />
            <div class="rows">
                <span>Hình đại diện:</span>
                <div style="clear:both; padding-top:5px;">
                    <div class="inputcontainer">
                        <div class="upload-file-L-Style2" id="UploadButton">
                            <div class="upload-file-R-Style2">
                                <input type="button" id="btnCartBtnMidText2" class="buttonDefault form-submit" style="cursor:pointer;" value="Chọn file" />
                            </div>
                        </div>        
                        <a>
                            <asp:FileUpload ID="strFileUpload" runat="server" class="fileNamelblSelect upload-file-styele2" style="cursor:pointer; border:1px solid #c00000;"
                                onchange="javascript:changeName(this);" size="1" />
                        </a>
                        <div style="color:Black;vertical-align:middle" class="upload-sort-box">
                            <asp:TextBox ID="txtfileUpload" Enabled="false" ReadOnly="true" runat="server" style="margin:2px 0 2px 3px;border:none;border-color: transparent; padding-top:3px; width:410px; background-color:#f5f5f5"></asp:TextBox>
                        </div>
                    </div>
                </div>
            </div>
            <br class="clear" />
            <div id="uploader">
                <asp:FileUpload ID="FileUpload1" runat="server" />
                <a href="javascript:jQuery('#<%=FileUpload1.ClientID%>').uploadifyUpload();">Upload Files</a>
                <asp:Label ID="lblID" runat="server"></asp:Label>
                <br />
                <div id="pane1">                
                </div>
                <br />
                <CKEditor:CKEditorControl ID="CKEditorControl1" runat="server" Width="520px" 
                    Height="300px" 
                    FilebrowserWindowFeatures="location=no,menubar=no,toolbar=no,dependent=yes,minimizable=no,modal=yes,alwaysRaised=yes,resizable=mo,scrollbars=yes" 
                    ResizeEnabled="False" 
                    ToolbarFull="Preview|Cut|Copy|Paste|PasteText|PasteFromWord"></CKEditor:CKEditorControl>
            </div>
        </div>
        <img src="<%= ResolveUrl("~/images/middleProduct_holder_bottom.png")%>" alt="" align="absbottom" />
    </div>
    
    <script type = "text/javascript">
        jQuery(document).ready(function () {
            jQuery("#<%=FileUpload1.ClientID%>").uploadify({
                'uploader': '<%= ResolveUrl("~/uploadify/uploadify.swf")%>',
                'script': '<%= ResolveUrl("~/uploadify/Upload.ashx")%>',
                'cancelImg': '<%= ResolveUrl("~/uploadify/cancel.png")%>',
                'folder': '<%= ResolveUrl("~/uploads")%>',
                'buttonText': 'Select files',
                'method': 'post',
                'multi': true,
                'auto': false,
                'queueSizeLimit': 10,
                'fileExt': '*.jpg;*.gif;*.png;*.bpg',
                'fileDesc': 'Image Files',
                'wmode': 'transparent',
                'scriptData': { 'name': 'nguoicungkho' },
                onSelect: function (evt, queueID, fileObj, response, data) { jQuery("#pane1").html(""); },
                onComplete: function (evt, queueID, fileObj, response, data) {
                    var str = "<div><img src='" + response + "' alt='' class='thumbs' />&nbsp;";
                    str += "<a href=\"javascript:addLinkToCKEditor('" + response + "');\">Nhúng hình</a>  |  ";
                    str += "<a href=\"javascript:SetAsAvatar('" + response + "');\">Chọn làm avatar</a>  |";
                    str += "  <a href='javascript:void(0);' id='" + data.fileCount + "' onclick=\"javascript:DeleteImg(this.id,'nguoicungkho','" + response + "')\">Xóa hình</a></div>";
                    jQuery("#pane1").append(str);
                },
                'onAllComplete': function (event, data) {

                }
            });
        });
    </script> 
</asp:Content>

